//
//  Extension+NSAttributedString.swift
//  SHWeibo01
//
//  Created by 卫平玉 on 16/8/1.
//  Copyright © 2016年 卫平玉. All rights reserved.
//

import UIKit


extension NSAttributedString{
    
    convenience init(emoticon: SHEmoticon,y: CGFloat,lineHeight: CGFloat) {
        // 文本附件
        let att = SHTextAttachment()
            // 赋值
        att.emoticon = emoticon
        // 设置image
        att.image = UIImage.getEmoticonImage(emoticon.path)
         // 记住一定要设置bounds
        att.bounds = CGRectMake(0, y, lineHeight, lineHeight)
        
        self.init(attachment:att)
    }
}